package demo7;

public class Print {
	boolean flag=true;
	public synchronized void printNumber() throws InterruptedException{
		for(int i=1;i<=52;i++){
			while(!flag){
				wait();
			}
			System.out.print(i);
			if(i%2==0){
				flag=false;
				notify();
			}
		}
	}
	public synchronized void printLetter() throws InterruptedException{
		for(char i='A';i<='Z';i++){
			while(flag){
				wait();
			}
			System.out.print(i);
			flag=true;
			notify();
		}
	}
}
